<!DOCTYPE html>
<html>
<head>
	<title>demo3 JSON</title>
	<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
</head>
<body>
	<input type="button" value="获取新闻列表"/>
	<div id="info">
		<img src="__PUBLIC__/Home/load.gif" alt="" id="loading" style="display: none;" />
		<ul></ul>
	</div>
	<script>
		$('input').click(function(){
			var ul = $('#info>ul');
			$.ajax({
				url:"{:U('dem3')}",
				type:'get',
				success:function(data){
					var result = eval(data);
					for(var i=0;i<result.length;i++)
					{
						//alert(result[i].title);
						ul.append('<li>'+result[i].title+'<em>'+result[i].publicTime+'</em></li>');
					}
				}
			});
		});
		$(document).ajaxStart(function(){
			$('#loading').show();
		});
		$(document).ajaxStop(function(){
			$('#loading').hide();
		});
	</script>
</body>
</html>